home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 6 / CU Amiga Magazine's Super CD-ROM 06 (1996)(EMAP Images)(GB)(Track 1 of 4)[!][issue 1997-01].iso / cucd / prog / mui / muirexx2.2 / demos / muidir / protfile.rexx < prev    next >
OS/2 REXX Batch file  |  1996-08-05  |  3KB  |  111 lines

  1. /*
  2.  
  3. Code:       renfile.rexx
  4. Author:     Russell Leighton
  5. Revision:   11 Jan 1996
  6.  
  7. Comments:   
  8.  
  9. */
  10.  
  11. options results
  12.  
  13. /* TAG ID definitions */
  14.  
  15. Weight =                          0x80421d1f /* V4  i.. WORD              */
  16. Dirlist_Directory =               0x8042ea41 /* V4  isg STRPTR            */
  17. Dirlist_RejectIcons =             0x80424808 /* V4  is. BOOL              */
  18. MUIA_Group_Spacing =                   0x8042866d /* V4  is. LONG              */
  19. MUIA_Selected =                        0x8042654b /* V4  isg BOOL              */
  20.  
  21. parse arg portname' ['sfile']'
  22.  
  23. call pragma('Directory','muidir:')
  24.  
  25. address VALUE portname
  26.  
  27. group ID DIR REGISTER
  28. ndir = result
  29.  
  30. if sfile ~= '' then do
  31.     protect = ''
  32.     switch ID PS ATTRS MUIA_Selected
  33.     if result=1 then protect = protect||'S'
  34.     switch ID PP ATTRS MUIA_Selected
  35.     if result=1 then protect = protect||'P'
  36.     switch ID PA ATTRS MUIA_Selected
  37.     if result=1 then protect = protect||'A'
  38.     switch ID PR ATTRS MUIA_Selected
  39.     if result=1 then protect = protect||'R'
  40.     switch ID PW ATTRS MUIA_Selected
  41.     if result=1 then protect = protect||'W'
  42.     switch ID PE ATTRS MUIA_Selected
  43.     if result=1 then protect = protect||'E'
  44.     switch ID PD ATTRS MUIA_Selected
  45.     if result=1 then protect = protect||'D'
  46.     address command 'protect "'sfile'" 'protect
  47. end
  48. window ID WPRO CLOSE
  49.  
  50. /* find next selected file */
  51.  
  52. dirlist ID DIR||ndir
  53. sfile = result
  54.  
  55. /* if there is no selected file then reread dirlist and return */
  56.  
  57. if sfile = '' then do
  58.     check ID ICN||ndir
  59.     flag = result
  60.     dirlist ID DIR||ndir REREAD ATTRS Dirlist_RejectIcons flag
  61.     dirlist ID DIR||(3-ndir) REREAD ATTRS Dirlist_RejectIcons flag
  62.     exit
  63. end
  64.  
  65. /* get file information */
  66.  
  67.     state = statef(sfile)
  68.     parse var state type size blocks protect s1 s2 s3 .
  69.  
  70. /* put up a requester to allow the user to change the protection
  71.    bits of the file.  Also allows the user to cancel the operation.  Note
  72.    that the string gadget command is set to this macro thereby setting
  73.    up a recursive loop.  This is the only way to handle multiple files
  74.    since all operations, in MUIRexx, are asyncronous. */
  75.  
  76. window ID WPRO
  77.     group HORIZ
  78.         label '"protect 'sfile' "'
  79.     group HORIZ ATTRS MUIA_Group_Spacing 0
  80.         if pos('S',protect) = 0 then flag = 0
  81.         else flag = 1
  82.         switch ID PS ATTRS MUIA_Selected flag LABEL 'S'
  83.         if pos('P',protect) = 0 then flag = 0
  84.         else flag = 1
  85.         switch ID PP ATTRS MUIA_Selected flag LABEL 'P'
  86.         if pos('A',protect) = 0 then flag = 0
  87.         else flag = 1
  88.         switch ID PA ATTRS MUIA_Selected flag LABEL 'A'
  89.         if pos('R',protect) = 0 then flag = 0
  90.         else flag = 1
  91.         switch ID PR ATTRS MUIA_Selected flag LABEL 'R'
  92.         if pos('W',protect) = 0 then flag = 0
  93.         else flag = 1
  94.         switch ID PW ATTRS MUIA_Selected flag LABEL 'W'
  95.         if pos('E',protect) = 0 then flag = 0
  96.         else flag = 1
  97.         switch ID PE ATTRS MUIA_Selected flag LABEL 'E'
  98.         if pos('D',protect) = 0 then flag = 0
  99.         else flag = 1
  100.         switch ID PD ATTRS MUIA_Selected flag LABEL 'D'
  101.     endgroup
  102.     endgroup
  103.     group HORIZ
  104.         button ATTRS Weight 0 COMMAND '"muidir:protfile 'portname' ['sfile']"' LABEL 'Ok'
  105.         space HORIZ
  106.         button ATTRS Weight 0 COMMAND '"window ID WPRO CLOSE"' PORT portname LABEL 'Cancel'
  107.     endgroup
  108. endwindow
  109.  
  110. exit
  111.